/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package beans;

import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import modelo.Moto;
import modelo.Registro;
import modelo.Socio;
import org.primefaces.event.FlowEvent;

/**
 *
 * @author fbaenaqu
 */
@ManagedBean
@ViewScoped
public class AltaSocioBean implements Serializable {

    private Socio socio;
    private Moto moto;
    private Registro registro;
    private FlowEvent event;

    public Socio getSocio() {
        return socio;
    }

    public void setSocio(Socio socio) {
        this.socio = socio;
    }

    public Moto getMoto() {
        return moto;
    }

    public void setMoto(Moto moto) {
        this.moto = moto;
    }

    public Registro getRegistro() {
        return registro;
    }

    public void setRegistro(Registro registro) {
        this.registro = registro;
    }

    public void save() {
        FacesMessage msg = new FacesMessage("Successful", "Socio registrado: " + registro.getNick());
        FacesContext.getCurrentInstance().addMessage(null, msg);
    }

    public String onFlowProcess(FlowEvent event) {
        return event.getNewStep();
    }
    
//    public String next(){
//        return event.getNewStep();
//    }
//    
//    public String back(){
//        return event.getOldStep();
//    }
}
